// Copyright 2011 Google Inc. All Rights Reserved.
// Author: jacobsa@google.com (Aaron Jacobs)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/** @typedef {function(!Object)} */
flame.ResolveCallback;

/**
 * Tell flame that it needs to load information about a set of actions. When the
 * actions have been resolved, a supplied callback is run.
 *
 * @param {!Array.<string>} actionNames
 *     A set of names of actions that should be resolved. flame will load the
 *     appropriate FLAME files, based on the package parts of the action names,
 *     and then call the callback with the resulting action objects. (If the
 *     actions cannot be found in the FLAME files, an error will be returned to
 *     the user and the callback will never be run.)
 *
 * @param {!flame.ResolveCallback} callback
 *     A function to run when the requested actions have been loaded. The
 *     callback will be passed an object mapping from the requested action names
 *     to flame.Action objects.
 */
flame.resolveActions = function(actionNames, callback) {
  flame.internal.resolveWork.push({
      'actionNames': actionNames,
      'callback': callback,
  });
};
